package com.cjm.algorithm.hash;

import java.util.HashSet;

public class Ti240423349 {
    public static void main(String[] args) {

    }
    public int[] intersection(int[] nums1, int[] nums2) {
        HashSet set = new HashSet();
        for (int i : nums1) {
            set.add(i);
        }
        HashSet<Integer> set2 = new HashSet();
        for (int i : nums2) {
            if (set.contains(i)) {
                set2.add(i);
            }
        }
        int[] res = new int[set2.size()];
        Object[] array = set2.toArray();
        for (int i = 0; i < array.length; i++) {
            array[i] = (int) array[i];
        }

        return res;
    }
}
